home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MAGCARD.ZIP / MAGCARD3.TXT < prev   
Text File  |  1995-11-28  |  48KB  |  920 lines

  1. *******************************************************************************
  2. *                                                                             *
  3. *              Card-O-Rama: Magnetic Stripe Technology and Beyond             *
  4. *                                                                             *
  5. *                                  or                                         *
  6. *                                                                             *
  7. *                  "A Day in the Life of a Flux Reversal"                     *
  8. *                                                                             *
  9. *                                                                             *
  10. *                                                                             *
  11. *                     by: ..oooOO Count Zero OOooo.. .RDT.       11/22/91     *
  12. *                                                                             *
  13. *******************************************************************************
  14.  
  15. ---A production of :    -=Restricted -=Data -=Transmissions    :
  16.                    :                                           :
  17.                    : "Truth is cheap, but information costs."  :
  18.                     
  19.    Look in your wallet.  Chances are you own at least 3 cards that have 
  20. magnetic stripes on the back.  ATM cards, credit cards, calling cards, 
  21. frequent flyer cards, ID cards, passcards,...cards, cards, cards!  And chances
  22. are you have NO idea what information is on those stripes or how they are
  23. encoded.  This detailed document will enlighten you and hopefully spark your 
  24. interest in this fascinating field.  None of this info is 'illegal'...but
  25. MANY organizations (government, credit card companies, security firms,
  26. etc.) would rather keep you in the dark.  Also, many people will IMMEDIATELY 
  27. assume that you are a CRIMINAL if you merely "mention" that you are
  28. "interested in how magnetic stripe cards work."  Watch yourself, ok?  Just 
  29. remember that there's nothing wrong with wanting to know how things work, altho
  30. in our present society, you may be labelled a "deviant" (or worse, a <gasp>
  31. "hacker!").
  32.     
  33.    Anyway, I will explain in detail how magstripes are encoded and give
  34. several examples of the data found on some common cards.  I will also cover the
  35. technical theory behind magnetic encoding, and discuss magnetic encoding
  36. alternatives to magstripes (Wiegand, barium ferrite).  Non-magnetic card
  37. technology (bar code, infrared, etc.) will be described.  Finally, there will
  38. be an end discussion on security systems and the ramifications of emergent
  39. "smartcard" and biometric technologies.
  40.    
  41.                            *DISCLAIMER*
  42.  
  43.    Use this info to EXPLORE, not to EXPLOIT.  This text is presented for
  44. informational purposes only, and I cannot be held responsible for anything you
  45. do or any consequences thereof.  I do not condone fraud, larceny, or any other
  46. criminal activities. 
  47.  
  48.                            *A WARNING*
  49.  
  50.    I've noticed lately a few "books" and "magazines" for sale that were
  51. FILLED with PHILES on a variety of computer topics.  These philes were
  52. originally released into the Net with the intention of distributing them for
  53. FREE.  HOWEVER, these philes are now being PACKAGED and sold FOR PROFIT.  This
  54. really pisses me off.  I am writing this to be SHARED for FREE, and I ask no
  55. payment.  Feel free to reprint this in hardcopy format and sell it if you must,
  56. but NO PROFITS must be made.  Not a fucking DIME!  If ANYONE reprints this
  57. phile and tries to sell it FOR A PROFIT, I will hunt you down and make your
  58. life miserable.  How?  Use your imagination.  The reality will be worse.  
  59.  
  60.  
  61.                            
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.              **  MAGSTRIPE FIELDS, HEADS, ENCODING/READING **
  69.  
  70.  
  71.    Whew!  I'll get down to business now.  First, I am going to explain the
  72. basics behind fields, heads, encoding and reading.  Try and absorb the THEORY
  73. behind encoding/reading.  This will help you greatly if you ever decide to 
  74. build your own encoder/reader from scratch (more on that later). 
  75. FERROMAGNETIC materials are substances that retain magnetism after an external
  76. magnetizing field is removed.  This principle is the basis of ALL magnetic
  77. recording and playback.  Magnetic POLES always occur in pairs within magnetized
  78. material, and MAGNETIC FLUX lines emerge from the NORTH pole and
  79. terminate at the SOUTH.  The elemental parts of MAGSTRIPES are ferromagnetic
  80. particles about 20 millionths of an inch long, each of which acts like a tiny
  81. bar magnet.  These particles are rigidly held together by a resin binder. 
  82. The magnetic particles are made by companies which make coloring pigments
  83. for the paint industry, and are usually called pigments.  When making the
  84. magstripe media, the elemental magnetic particles are aligned with their
  85. North-South axes parallel to the magnetic stripe by means of an external
  86. magnetic fields while the binder hardens.
  87.  
  88.    These particles are actually permanent bar magnets with TWO STABLE
  89. POLARITIES.  If a magnetic particle is placed in a strong external magnetic
  90. field of the opposite polarity, it will FLIP its own polarity (North becomes
  91. South, South becomes North).  The external magnetic field strength required to 
  92. produce this flip is called the COERCIVE FORCE, or COERCIVITY of the particle.
  93. Magnetic pigments are available in a variety of coercivities (more on that 
  94. lateron).
  95.  
  96.    An unencoded magstripe is actually a series of North-South magnetic
  97. domains (see Figure 1).  The adjacent N-S fluxes merge, and the entire stripe
  98. acts as a single bar magnet with North and South poles at its ends.
  99.  
  100.  
  101. Figure 1:               N-S.N-S.N-S.N-S.N-S.N-S.N-S.N-S <-particles in stripe
  102. ---------                        
  103.        represented as-> N-----------------------------S
  104.                                        
  105.  
  106.    However, if a S-S interface is created somewhere on the stripe, the fluxes
  107. will REPEL, and we get a concentration of flux lines around the S-S interface.
  108. (same with N-N interface)  ENCODING consists of creating S-S and N-N 
  109. interfaces, and READING consists of (you guessed it) detecting 'em.  The S-S
  110. and N-N interfaces are called FLUX REVERSALS.
  111.  
  112.  
  113.                             ||| ||| <-flux lines
  114. Figure 2:      N------------N-N-S-S-----------------S
  115. ---------     flux lines -> ||| |||
  116.  
  117.  
  118.   The external magnetic field used to flip the polarities is produced by a 
  119. SOLENOID, which can REVERSE its polarity by reversing the direction of CURRENT.
  120. An ENCODING head solenoid looks like a bar magnet bent into the shape of a ring
  121. so that the North/South poles are very close and face each other across a tiny
  122. gap.  The field of the solenoid is concentrated across this gap, and when 
  123. elemental magnetic particles of the magstripe are exposed to this field, they
  124. polarize to the OPPOSITE (unlike poles attract).  Movement of the stripe past
  125. the solenoid gap during which the polarity of the solenoid is REVERSED will
  126. produce a SINGLE flux reversal (see Figure 3).  To erase a magstripe, the
  127. encoding head is held at a CONSTANT polarity and the ENTIRE stripe is moved
  128. past it.  No flux reversals, no data. 
  129.  
  130.  
  131.  
  132.  
  133.  
  134.                               | |  <----wires leading to solenoid      
  135.                               | |       (wrapped around ring)
  136.                             /-|-|-\                          
  137.                            /       \
  138. Figure 3:                  |       | <----solenoid (has JUST changed polarity)                           
  139. ---------                  \       /
  140.                             \ N S / <---gap in ring.. NS polarity across gap
  141.       N----------------------SS-N-------------------------S
  142.                              ^^  
  143.                    <<<<<-direction of stripe movement
  144.  
  145.           S-S flux reversal created at trailing edge of solenoid!
  146.  
  147.  
  148.    So, we now know that flux reversals are only created the INSTANT the 
  149. solenoid CHANGES its POLARITY.  If the solenoid in Figure 3 were to remain at 
  150. its current polarity, no further flux reversals would be created as the 
  151. magstripe moves from right to left.  But, if we were to change the solenoid
  152. gap polarity from NS to *SN*, then (you guessed it) a *N-N* flux reversal would
  153. instantly be created.  Just remember, for each and every reversal in solenoid
  154. polarity, a single flux reversal is created (commit it to memory..impress your
  155. friends..be a tech weenie!).  An encoded magstripe is therefore just a series 
  156. of flux reversals (NN followed by SS followed by NN ...).
  157.  
  158.   DATA! DATA! DATA!  That's what you want!  How the hell are flux reversals 
  159. read and interpreted as data?  Another solenoid called a READ HEAD is used to
  160. detect these flux reversals.  The read head operates on the principle of
  161. ELECTROMAGNETIC RECIPROCITY: current passing thru a solenoid produces a 
  162. magnetic field at the gap, therefore, the presence of a magnetic field at the
  163. gap of a solenoid coil will *produce a current in the coil*!  The strongest
  164. magnetic fields on a magstrip are at the points of flux reversals.  These are
  165. detected as voltage peaks by the reader, with +/- voltages corresponding to
  166. NN/SS flux reversals (remember, flux reversals come in 2 flavors).  
  167. See Figure 4.
  168.  
  169.  
  170.               magstripe---> -------NN--------SS--------NN---------SS------
  171.            
  172. Figure 4:     voltage-----> .......+.........-.........+...........-.....
  173. ---------
  174.                                    ----------          -------------
  175.             peak readout-->        |        |          |           |
  176.                            --------|        |----------|           |----
  177.  
  178.                                        
  179.    The 'peak readout' square waveform is critical.  Notice that the voltage 
  180. peak remains the same until a new flux reversal is encountered.   
  181.  
  182.    Now, how can we encode DATA?  The most common technique used is known as
  183. Aiken Biphase, or 'two-frequency coherent-phase encoding' (sounds impressive,
  184. eh?).  First, digest the diagrams in Figure 5.
  185.                                                                              
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                                                                              
  203. Figure 5:       ----------        ----------        ----------                                                      
  204. ---------       |        |        |        |        |        |  <- peak                           
  205.          a)     |        |--------|        |--------|        |     readouts                                 
  206.                                                                              
  207.                 *   0    *   0    *   0    *   0    *   0    *
  208.                                                              
  209.                                                                             
  210.                 -----    -----    -----    -----    -----    -
  211.                 |   |    |   |    |   |    |   |    |   |    |
  212.         b)      |   |----|   |----|   |----|   |----|   |----|
  213.  
  214.                 *   1    *   1    *   1    *   1    *   1    *
  215.  
  216.                 -----    ----------        -----    -----    -
  217.                 |   |    |        |        |   |    |   |    |                          
  218.         c)      |   |----|        |--------|   |----|   |----|                                               
  219.                                                                             
  220.                 *   1    *   0    *   0    *   1    *   1    *
  221.                                                                
  222.  
  223.    There ya have it.   Data is encoded in 'bit cells,' the frequency of which
  224. is the frequency of '0' signals.  '1' signals are exacty TWICE the frequency
  225. of '0' signals.  Therefore, while the actual frequency of the data passing
  226. the read head will vary due to swipe speed, data density, etc, the '1'
  227. frequency will ALWAYS be TWICE the '0' frequency.  Figure 5C shows exactly how
  228. '1' and '0' data exists side by side.
  229.  
  230.    We're getting closer to read DATA!  Now, we're all familiar with binary
  231. and how numbers and letters can be represented in binary fashion very easily.
  232. There are obviously an *infinite* number of possible standards, but thankfully
  233. the American National Standards Institute (ANSI) and the International
  234. Standards Organization (ISO) have chosen 2 standards.  The first is
  235.  
  236.  
  237.                    ** ANSI/ISO BCD Data format **
  238.  
  239.   This is a 5-bit Binary Coded Decimal format.  It uses a 16-character set,
  240. which uses 4 of the 5 available bits.  The 5th bit is an ODD parity bit, which
  241. means there must be an odd number of 1's in the 5-bit character..the parity bit
  242. will 'force' the total to be odd.  Also, the Least Significant Bits are read
  243. FIRST on the strip.  See Figure 6.
  244.  
  245.   The sum of the 1's in each case is odd, thanks to the parity bit.  If the
  246. read system adds up the 5 bits and gets an EVEN number, it flags the read
  247. as ERROR, and you gotta scan the card again.  (yeah, I *know* a lot of you
  248. out there *already* understand parity, but I gotta cover all the bases...not
  249. everyone sleeps with their modem and can recite the entire AT command set
  250. at will, you know ;).  See Figure 6 for details of ANSI/ISO BCD.
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264. Figure 6:        ANSI/ISO BCD Data Format
  265. ---------
  266.  
  267.  * Remember that b1 (bit #1) is the LSB (least significant bit)!
  268.   * The LSB is read FIRST!
  269.   * Hexadecimal conversions of the Data Bits are given in parenthesis (xH).
  270.        
  271.         --Data Bits--   Parity 
  272.         b1  b2  b3  b4   b5    Character  Function
  273.                                  
  274.         0   0   0   0    1        0 (0H)    Data
  275.         1   0   0   0    0        1 (1H)      " 
  276.         0   1   0   0    0        2 (2H)      " 
  277.         1   1   0   0    1        3 (3H)      " 
  278.         0   0   1   0    0        4 (4H)      " 
  279.         1   0   1   0    1        5 (5H)      " 
  280.         0   1   1   0    1        6 (6H)      " 
  281.         1   1   1   0    0        7 (7H)      " 
  282.         0   0   0   1    0        8 (8H)      " 
  283.         1   0   0   1    1        9 (9H)      " 
  284.         0   1   0   1    1        : (AH)    Control
  285.         1   1   0   1    0        ; (BH)    Start Sentinel
  286.         0   0   1   1    1        < (CH)    Control
  287.         1   0   1   1    0        = (DH)    Field Separator
  288.         0   1   1   1    0        > (EH)    Control
  289.         1   1   1   1    1        ? (FH)    End Sentinel
  290.  
  291.  
  292.            ***** 16 Character 5-bit Set *****
  293.                 10 Numeric Data Characters
  294.                 3 Framing/Field Characters
  295.                 3 Control Characters
  296.          
  297.  
  298.     The magstripe begins with a string of Zero bit-cells to permit the
  299. self-clocking feature of biphase to "sync" and begin decoding.
  300. A "Start Sentinel" character then tells the reformatting process where to start
  301. grouping the decoded bitstream into groups of 5 bits each.  At the end of the
  302. data, an "End Sentinel" is encountered, which is followed by an "Longitudinal
  303. Redundancy Check (LRC) character.  The LRC is a parity check for the sums of 
  304. all b1, b2, b3, and b4 data bits of all preceding characters.  The LRC 
  305. character will catch the remote error that could occur if an individual
  306. character had two compensating errors in its bit pattern (which would fool the
  307. 5th-bit parity check).  
  308.  
  309.    The START SENTINEL, END SENTINEL, and LRC are collectively called "Framing
  310. Characters", and are discarded at the end of the reformatting process.
  311.  
  312.            
  313.                   ** ANSI/ISO ALPHA Data Format **
  314.  
  315.    Alphanumeric data can also be encoded on magstripes.  The second ANSI/ISO
  316. data format is ALPHA (alphanumeric) and involves a 7-bit character set with
  317. 64 characters.  As before, an odd parity bit is added to the required 6 data
  318. bits for each of the 64 characters.  See Figure 7.
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329. Figure 7:
  330. ---------             ANSI/ISO ALPHA Data Format
  331.  
  332.    * Remember that b1 (bit #1) is the LSB (least significant bit)!  
  333.    * The LSB is read FIRST!
  334.    * Hexadecimal conversions of the Data Bits are given in parenthesis (xH).
  335.  
  336.  
  337.          ------Data Bits-------   Parity
  338.          b1  b2  b3  b4  b5  b6     b7    Character   Function
  339.  
  340.           0   0   0   0   0   0     1      space (0H) Special
  341.           1   0   0   0   0   0     0        ! (1H)      "
  342.           0   1   0   0   0   0     0        " (2H)      "
  343.           1   1   0   0   0   0     1        # (3H)      "
  344.           0   0   1   0   0   0     0        $ (4H)      "
  345.           1   0   1   0   0   0     1        % (5H)   Start Sentinel
  346.           0   1   1   0   0   0     1        & (6H)   Special
  347.           1   1   1   0   0   0     0        ' (7H)      "
  348.           0   0   0   1   0   0     0        ( (8H)      "
  349.           1   0   0   1   0   0     1        ) (9H)      "
  350.           0   1   0   1   0   0     1        * (AH)      "
  351.           1   1   0   1   0   0     0        + (BH)      "
  352.           0   0   1   1   0   0     1        , (CH)      "
  353.           1   0   1   1   0   0     0        - (DH)      "
  354.           0   1   1   1   0   0     0        . (EH)      "
  355.           1   1   1   1   0   0     1        / (FH)      "
  356.  
  357.           0   0   0   0   1   0     0        0 (10H)    Data (numeric)
  358.           1   0   0   0   1   0     1        1 (11H)     "
  359.           0   1   0   0   1   0     1        2 (12H)     "
  360.           1   1   0   0   1   0     0        3 (13H)     "
  361.           0   0   1   0   1   0     1        4 (14H)     "
  362.           1   0   1   0   1   0     0        5 (15H)     " 
  363.           0   1   1   0   1   0     0        6 (16H)     "
  364.           1   1   1   0   1   0     1        7 (17H)     " 
  365.           0   0   0   1   1   0     1        8 (18H)     "
  366.           1   0   0   1   1   0     0        9 (19H)     "
  367.                                                
  368.           0   1   0   1   1   0     0        : (1AH)   Special
  369.           1   1   0   1   1   0     1        ; (1BH)      "
  370.           0   0   1   1   1   0     0        < (1CH)      "
  371.           1   0   1   1   1   0     1        = (1DH)      "
  372.           0   1   1   1   1   0     1        > (1EH)      "
  373.           1   1   1   1   1   0     0        ? (1FH)   End Sentinel
  374.           0   0   0   0   0   1     0        @ (20H)   Special   
  375.  
  376.           1   0   0   0   0   1     1        A (21H)   Data (alpha) 
  377.           0   1   0   0   0   1     1        B (22H)     "
  378.           1   1   0   0   0   1     0        C (23H)     "
  379.           0   0   1   0   0   1     1        D (24H)     " 
  380.           1   0   1   0   0   1     0        E (25H)     "
  381.           0   1   1   0   0   1     0        F (26H)     "  
  382.           1   1   1   0   0   1     1        G (27H)     "
  383.           0   0   0   1   0   1     1        H (28H)     "
  384.           1   0   0   1   0   1     0        I (29H)     "
  385.           0   1   0   1   0   1     0        J (2AH)     "
  386.           1   1   0   1   0   1     1        K (2BH)     "
  387.           0   0   1   1   0   1     0        L (2CH)     "  
  388.           1   0   1   1   0   1     1        M (2DH)     "
  389.           0   1   1   1   0   1     1        N (2EH)     "   
  390.           1   1   1   1   0   1     0        O (2FH)     " 
  391.           0   0   0   0   1   1     1        P (30H)     "
  392.           1   0   0   0   1   1     0        Q (31H)     "  
  393.           0   1   0   0   1   1     0        R (32H)     "
  394.           1   1   0   0   1   1     1        S (33H)     "
  395.           0   0   1   0   1   1     0        T (34H)     "
  396.           1   0   1   0   1   1     1        U (35H)     "
  397.           0   1   1   0   1   1     1        V (36H)     "
  398.           1   1   1   0   1   1     0        W (37H)     "
  399.           0   0   0   1   1   1     0        X (38H)     "  
  400.           1   0   0   1   1   1     1        Y (39H)     "
  401.           0   1   0   1   1   1     1        Z (3AH)     "
  402.  
  403.           1   1   0   1   1   1     0        [ (3BH)    Special
  404.           0   0   1   1   1   1     1        \ (3DH)    Special
  405.           1   0   1   1   1   1     0        ] (3EH)    Special
  406.           0   1   1   1   1   1     0        ^ (3FH)    Field Separator
  407.           1   1   1   1   1   1     1        _ (40H)    Special
  408.   
  409.               ***** 64 Character 7-bit Set *****
  410.                   * 43 Alphanumeric Data Characters
  411.                   * 3 Framing/Field Characters
  412.                   * 18 Control/Special Characters
  413.  
  414.  
  415.    The two ANSI/ISO formats, ALPHA and BCD, allow a great variety of data to be
  416. stored on magstripes.  Most cards with magstripes use these formats, but 
  417. occasionally some do not.  More about those lateron.  
  418.  
  419.  
  420.                    ** Tracks and Encoding Protocols **
  421.  
  422.    Now we know how the data is stored.  But WHERE is the data stored on the
  423. magstripe?  ANSI/ISO standards define *3* Tracks, each of which is used for
  424. different purposes.  These Tracks are defined only by their location on the
  425. magstripe, since the magstripe as a whole is magnetically homogeneous.  See
  426. Figure 8.
  427.  
  428.  
  429. Figure 8:
  430. ---------          <edge of card>
  431.          _________________________________________________________________
  432.          |                  ^         ^         ^
  433.          |------------------| 0.223"--|---------|-------------------------
  434.          |                  |         | 0.353"  |            ^
  435.          |..................|.........|.........| 0.493"     |         
  436.          | Track #1  0.110"           |         |            |
  437.          |............................|.........|...     <MAGSTRIPE>
  438.          |                            |         |            | 
  439.          |............................|.........|...         |        
  440.          | Track #2  0.110"                     |            |
  441.          |......................................|...         |         
  442.          |                                      |            | 
  443.          |......................................|...         |          
  444.          | Track #3  0.110"                                  |
  445.          |..........................................         |               
  446.          |                                                   |
  447.          |------------------------------------------------------------------
  448.          |
  449.          |                   <body of card>
  450.          |
  451.  
  452.  
  453.    You can see the exact distances of each track from the edge of the card, as
  454. well as the uniform width and spacing.  Place a magstripe card in front of you
  455. with the magstripe visible at the bottom of the card.  Data is encoded from
  456. left to right (just like reading a book, eh?).  See Figure 9.
  457.  
  458.  
  459. Figure 9:
  460. ---------          ANSI/ISO Track 1,2,3 Standards
  461.  
  462.      Track     Name     Density     Format    Characters     Function
  463.    --------------------------------------------------------------------
  464.        1       IATA     210 bpi     ALPHA        79        Read Name & Account
  465.        2       ABA       75 bpi      BCD         40        Read Account
  466.        3       THRIFT   210 bpi      BCD        107        Read Account &
  467.                                                            *Encode* Transaction
  468.  
  469.  
  470.    *** Track 1 Layout: ***     
  471.  
  472.              | SS | FC |  PAN  |   Name   | FS |  Additional Data | ES | LRC |
  473.  
  474.  SS=Start Sentinel "%"
  475.  FC=Format Code
  476.  PAN=Primary Acct. # (19 digits max)
  477.  FS=Field Separator "^"
  478.  Name=26 alphanumeric characters max.
  479.  Additional Data=Expiration Date, offset, encrypted PIN, etc.
  480.  ES=End Sentinel "?"
  481.  LRC=Longitudinal Redundancy Check
  482.  
  483.  
  484.    *** Track 2 Layout: ***
  485.  
  486.            | SS |  PAN  | FS |  Additional Data  | ES | LRC |
  487.  
  488.  SS=Start Sentinel ";"
  489.  PAN=Primary Acct. # (19 digits max)
  490.  FS=Field Separator "="
  491.  Additional Data=Expiration Date, offset, encrypted PIN, etc.
  492.  ES=End Sentinel "?"
  493.  LRC=Longitudinal Redundancy Check 
  494.  
  495.  
  496.    *** Track 3 Layout: **  Similar to tracks 1 and 2.  Almost never used.
  497.                            Many different data standards used.
  498.  
  499.  
  500.    Track 2, "American Banking Association," (ABA) is most commonly used.  This
  501. is the track that is read by ATMs and credit card checkers.  The ABA designed
  502. the specifications of this track and all world banks must abide by it.  It
  503. contains the cardholder's account, encrypted PIN, plus other discretionary
  504. data. 
  505.  
  506.    Track 1, named after the "International Air Transport Association," contains
  507. the cardholder's name as well as account and other discretionary data.  This
  508. track is sometimes used by the airlines when securing reservations with a
  509. credit card; your name just "pops up" on their machine when they swipe your
  510. card!
  511. Since Track 1 can store MUCH more information, credit card companies are trying
  512. to urge retailers to buy card readers that read Track 1.  The *problem* is that
  513. most card readers read either Track 1 or Track 2, but NOT BOTH!  And the
  514. installed base of readers currently is biased towards Track 2.  VISA USA is at
  515. the front of this 'exodus' to Track 1, to the point where they are offering
  516. Track 1 readers at reduced prices thru participating banks.  A spokesperson for
  517. VISA commented:
  518.                 "We think that Track 1 represents more flexibility and the
  519.                  potential to deliver more information, and we intend to 
  520.                  build new services around the increased information."
  521.  
  522.    What new services?  We can only wait and see.
  523.  
  524.    Track 3 is unique.  It was intended to have data read and WRITTEN on it.
  525. Cardholders would have account information UPDATED right on the magstripe.  
  526. Unfortunately, Track 3 is pretty much an orphaned standard.  Its *original*
  527. design was to control off-line ATM transactions, but since ATMs are now on-line
  528. ALL THE TIME, it's pretty much useless.  Plus the fact that retailers and banks
  529. would have to install NEW card readers to read that track, and that costs $$.
  530.  
  531.    Encoding protocol specifies that each track must begin and end with a length
  532. of all Zero bits, called CLOCKING BITS.  These are used to synch the self-
  533. clocking feature of biphase decoding.  See Figure 10.
  534.  
  535. Figure 10:                              end sentinel
  536.                      start sentinel      |  longitudinal redundancy check
  537.                       |                  |  |
  538.       000000000000000 SS.................ES LRC 0000000000000000
  539.        leading           data, data, data           trailing
  540.        clocking bits                                clocking bits
  541.        (length varies)                             (length varies)
  542.   
  543.    THAT'S IT!!!  There you have the ANSI/ISO STANDARDS!  Completely explained.
  544. Now, the bad news.  NOT EVERY CARD USES IT!  Credit cards and ATM cards will
  545. follow these standards.  BUT, there are many other types of cards out there.
  546. Security passes, copy machine cards, ID badges, and EACH of them may use a
  547. PROPRIETARY density/format/track-location system.  ANSI/ISO is REQUIRED for
  548. financial transaction cards used in the international interbank network.  All
  549. other cards can play their own game.
  550.  
  551.    The good news.  MOST other cards follow the standards, because it's EASY to
  552. follow a standard instead of WORKING to make your OWN!  Most magstripe cards
  553. other than credit cards and ATM cards will use the same Track specifications,
  554. and use either BCD or ALPHA formats. 
  555.  
  556.  
  557.  
  558.                     ** A Bit About Magstripe Equipment **
  559.  
  560.   "Wow, now I know how to interpret all that data on magstripes!  But...
  561. waitasec, what kind of equipment do I need to read the stripes?
  562. Where can I buy a reader?  I don't see any in Radio Shack!!"
  563.  
  564.    Sorry, but magstripe equipment is hard to come by.  For obvious reasons,
  565. card readers are not made commonly available to consumers.  How to
  566. build one is the topic for another phile (and THIS phile is already too long!).
  567.  
  568.   Your best bets are to try and scope out Electronic Surplus Stores and flea
  569. markets.  Don't even bother trying to buy one directly from a manufacturer,
  570. since they will immediately assume you have "criminal motives."  And as for
  571. getting your hands on a magstripe ENCODER...well, good luck!  Those rare 
  572. beauties are worth their weight in gold.  Keep your eyes open and look around,
  573. and MAYBE you'll get lucky!  A bit of social engineering can go a LONG way.
  574.  
  575.    There are different kinds of magstripe readers/encoders.  The most common
  576. ones are "swipe" machines: the type you have to physically slide the card thru.
  577. Others are "insertion" machines: like ATM machines they 'eat' your card, then
  578. regurgitate it after the transaction.  Costs are in the thousands of dollars,
  579. but like I said, flea markets and surplus stores will often have GREAT deals
  580. on these things.  Another problem is documentation for these machines.  If you
  581. call the manufacturer and simply ask for 'em, they will probably deny you the
  582. literature. "Hey son, what are you doing with our model XYZ swipe reader?  That
  583. belongs in the hands of a 'qualified' merchant or retailer, not some punk kid
  584. trying to 'find out how things work!"  Again, some social engineering may be
  585. required.  Tell 'em you're setting up a new business.  Tell 'em you're working
  586. on a science project.  Tell 'em anything that works!
  587.  
  588.    2600 Magazine recently had a good article on how to build a machine that
  589. copies magstripe cards.  Not much info on the actual data formats and encoding
  590. schemes, but the device described is a start.  With some modifications, I bet
  591. you could route the output to a dumb terminal (or thru a null modem cable) in
  592. order to READ the data.  Worth checking out the schematics.
  593.  
  594.    As for making your own cards, just paste a length of VCR, reel-to-reel, or
  595. audio cassette tape to a cut-out posterboard or plastic card.  Works just as
  596. good as the real thing, and useful to experiment with if you have no expired or
  597. 'dead' ATM or calling cards lying around (SAVE them, don't TOSS them!).
  598.  
  599.  
  600.              
  601.                  ** Examples of Data on Magstripes **
  602.  
  603.    The real fun in experimenting with magstripe technology is READING cards to
  604. find out WHAT THE HELL is ON them!  Haven't you wondered?  The following cards
  605. are the result of my own 'research'.  Data such as specific account numbers and
  606. names has been changed to protect the innocent.  None the cards used to make
  607. this list were stolen or acquired illegally.
  608.  
  609.    Notice that I make careful note of 'common data'; data that I noticed was
  610. the same for all cards of a particular type.  This is highlighted below the
  611. data with asterisks (*).  Where I found varying data, I indicate it with "x"'s.
  612. In those cases, NUMBER of CHARACTERS was consistent (the number of "x"'s equals
  613. the number of characters...one to one relationship).
  614.  
  615.    I still don't know what some of the data fields are for, but hopefully I
  616. will be following this phile with a sequel after I collect more data.  It ISN'T
  617. easy to find lots of cards to examine. Ask your friends, family, and co-workers
  618. to help!  "Hey, can I, um, like BORROW your MCI calling card tonite?  I'm
  619. working on an, um, EXPERIMENT.  Please?"  Just...be honest!  Also, do some
  620. trashing.  People will often BEND expired cards in half, then throw them out.
  621. Simply bend 'em back into their normal shape, and they'll usually work (I've 
  622. done it!).  They may be expired, but they're not ERASED!  
  623. -------------------------------------------------------------------------------
  624. -=Mastercard=-  Number on front of card -> 1111 2222 3333 4444
  625.                 Expiration date -> 12/99 
  626.  
  627. Track 2 (BCD,75 bpi)-> ;1111222233334444=99121010000000000000?
  628.                                              ***
  629.           
  630. Track 1 (ALPHA,210 bpi)-> %B1111222233334444^PUBLIC/JOHN?
  631.                            *
  632. Note that the "101" was common to all MC cards checked, as well as the "B".
  633. -------------------------------------------------------------------------------
  634. -=VISA=-  Number on front of card -> 1111 2222 3333 4444
  635.           Expiration date -> 12/99
  636.  
  637. Track 2 (BCD,75 bpi)-> ;1111222233334444=9912101xxxxxxxxxxxxx?
  638.                                              ***
  639. Track 1 (ALPHA,210 bpi)-> %B1111222233334444^PUBLIC/JOHN^9912101xxxxxxxxxxxxx?
  640.                            *
  641.  
  642. Note that the "101" was common to all VISA cards checked, as well as the "B".
  643. Also, the "xxx" indicates numeric data that varied from card to card, with no
  644. apparent pattern.  I believe this is the encrypted pin for use when cardholders
  645. get 'cash advances' from ATMs.  In every case, tho, I found *13* digits of the
  646. stuff.
  647. -------------------------------------------------------------------------------
  648. -=Discover=-  Number on front of card -> 1111 2222 3333 4444
  649.               Expiration date -> 12/99
  650.  
  651. Track 2 (BCD,75 bpi)-> ;1111222233334444=991210100000?
  652.                                              ********
  653.  
  654. Track 1 (ALPHA,210 bpi)-> %B1111222233334444^PUBLIC/JOHN___^991210100000?
  655.                                                                 ******** 
  656. Note, the "10100000" and "B" were common to most DISCOVER cards checked.
  657. I found a few that had "10110000" instead.  Don't know the significance.
  658. Note the underscores after the name JOHN.  I found consistently that the name
  659. data field had *26* charaters.  Whatever was left of the field after the name
  660. was "padded" with SPACES.  Soo...for all of you with names longer than 25 
  661. (exclude the "/") charaters, PREPARE to be TRUNCATED! ;)
  662. -------------------------------------------------------------------------------
  663. -=US Sprint FON=-  Number on front of card -> 111 222 3333 4444
  664.  
  665. Track 2 (BCD,75 bpi)-> ;xxxxxx11122233339==xxx4444xxxxxxxxxx=?
  666.                                         *
  667.  
  668. Track 1 (ALPHA,210 bpi)-> %B^ /^^xxxxxxxxxxxxxxxxx?
  669.                            *
  670.  
  671. Strange.  None of the cards I check had names in the Track 1 fields.  Track 1
  672. looks unused, yet it was always formatted with field separators.  The "xxx"
  673. stuff varied from card to card, and I didn't see a pattern.  I know it isn't
  674. a PIN, so it must be account data.
  675. -------------------------------------------------------------------------------
  676. -=Fleet Bank=-  Number on front of card -> 111111 222 3333333
  677.                 Expiration date -> 12/99
  678.  
  679. Track 2 (BCD,75 bpi)-> ;1111112223333333=9912120100000000xxxx?
  680.                                              ****        
  681.  
  682. Track 1 (ALPHA,210 bpi) ->
  683.          %B1111112223333333^PUBLIC/JOHN___^9912120100000000000000xxxx000000?
  684.           *                                    ****
  685.  
  686. Note that the "xxx" data varied.  This is the encrypted PIN offset.  Always 4
  687. digits (hrmmm...).  The "1201" was always the same.  In fact, I tried many
  688. ATM cards from DIFFERENT BANKS...and they all had "1201".  
  689. -------------------------------------------------------------------------------
  690. (Can't leave *this* one out ;)
  691. -=Radio Shack=-  Number on front of card -> 1111 222 333333
  692.                  NO EXPIRATION data on card
  693.  
  694. Track 2 (BCD,75 dpi)-> ;1111222333333=9912101?
  695.                                       *******
  696.  
  697. Note that the "9912101" was the SAME for EVERY Radio Shack card I saw.  Looks
  698. like when they don't have 'real' data to put in the expiration date field, they
  699. have to stick SOMETHING in there.
  700. -------------------------------------------------------------------------------
  701.  
  702.   Well, that's all I'm going to put out right now.  As you can see, the major
  703. types of cards (ATMs, CC) all follow the same rules more or less.  I checked
  704. out a number of security passcards and timeclock entry cards..and they ALL had
  705. random stuff written to Track 2.  Track 2 is by FAR the MOST utilized track on
  706. the card.  And the format is pretty much always ANSI/ISO BCD.  I *did* run
  707. into some hotel room access cards that, when scanned, were GARBLED.  They most
  708. likely used a character set other than ASCII (if they were audio tones, my
  709. reader would have put out NOTHING...as opposed to GARBLED data).  As you can
  710. see, one could write a BOOK listing different types of card data.  I intended
  711. only to give you some examples.  My research has been limited, but I tried to
  712. make logical conclusions based on the data I received. 
  713.  
  714.  
  715.  
  716.                       ** Cards of All Flavors **
  717.  
  718.    People wanted to store A LOT of data on plastic cards.  And they wanted that
  719. data to be 'invisible' to cardholders.  Here are the different card 
  720. technologies that were invented and are available today.
  721.  
  722. HOLLERITH - With this system, holes are punched in a plastic or paper card and
  723.             read optically.  One of the earliest technologies, it is now seen
  724.             as an encoded room key in hotels.  The technology is not secure, 
  725.             but cards are cheap to make.
  726.  
  727. BAR CODE -  The use of bar codes is limited.  They are cheap, but there is 
  728.             virtually no security and the bar code strip can be easily damaged.
  729.             
  730. INFRARED -  Not in widespread use, cards are factory encoded by creating a
  731.             "shadow pattern" within the card.  The card is passed thru a swipe
  732.             or insertion reader that uses an infrared scanner.  Infrared card
  733.             pricing is moderate to expensive, and encoding is pretty secure.
  734.             Infrared scanners are optical and therefore vulnerable to 
  735.             contamination.
  736.  
  737. PROXIMITY - Hands-free operation is the primary selling point of this card.
  738.             Altho several different circuit designs are used, all proximity
  739.             cards permit the transmission of a code simply by bringing the card
  740.             near the reader (6-12").  These cards are quite thick, up to 
  741.             0.15" (the ABA standard is 0.030"!).  
  742.  
  743. WIEGAND -   Named after its inventor, this technology uses a series of small
  744.             diameter wires that, when subjected to a changing magnetic field, 
  745.             induce a discrete voltage output in a sensing coil.  Two rows of
  746.             wires are embedded in a coded strip.  When the wires move past
  747.             the read head, a series of pulses is read and interpreted as binary
  748.             code.  This technology prodces card that are VERY hard to copy
  749.             or alter, and cards are moderately expensive to make.  Readers
  750.             based on this tech are epoxy filled, making them immune to weather
  751.             conditions, and neither card nor readers are affected by external
  752.             magnetic fields (don't worry about leaving these cards on top of
  753.             the television set...you can't hurt them!).  Here's an example of
  754.             the layout of the wires in a Wiegand strip:
  755.  
  756.                ||| || ||   | ||| | || ||    |  ||  ||    |   |  ||  
  757.                   |  |    | |   | |     ||||     ||  ||||     ||
  758.            
  759.             The wires are NOT visible from the outside of the card, but if
  760.             your card is white, place it in front of a VERY bright light source
  761.             and peer inside.  Notice that the spacings between the wires is
  762.             uniform.
  763.  
  764. BARIUM FERRITE - The oldest magnetic encoding technology (been around for 40
  765.                  yrs!) it uses small bits of magnetized barium ferrite that are
  766.                  placed inside a plastic card.  The polarity and location of
  767.                  the "spots" determines the coding.  These cards have a short
  768.                  life cycle, and are used EXTENSIVELY in parking lots (high
  769.                  turnover rate, minimal security).  Barium Ferrite cards are
  770.                  ONLY used with INSERTION readers.
  771.  
  772.    There you have the most commonly used cards.  Magstripes are common because
  773. they are CHEAP and relatively secure.  
  774.  
  775.  
  776.                          ** Magstripe Coercivity **
  777.  
  778.    Magstripes themselves come in different flavors.  The COERCIVITY of the 
  779. magnetic media must be specified.  The coercivity is the magnetic field 
  780. strength required to demagnetize an encoded stripe, and therefore determines 
  781. the encode head field strength required to encode the stripe.  A range of media
  782. coerciviteis are available ranging from 300 Oersteds to 4,000 Oe.  That boils
  783. down to HIGH-ENERGY magstripes (4,000 Oe) and LOW-ENERGY magstripes (300 Oe).
  784.  
  785.   REMEMBER: since all magstripes have the same magnetic remanence regardless of
  786. their coercivity, readers CANNOT tell the difference between HIGH and LOW
  787. energy stripes.  Both are read the same by the same machines.
  788.  
  789.    LOW-ENERGY media is most common.  It is used on all financial cards, but its
  790. disadvantage is that it is subject to accidental demagnetization from contact
  791. with common magnets (refrigerator, TV magnetic fields, etc.).  But these cards
  792. are kept safe in wallets and purses most of the time.
  793.  
  794.    HIGH-ENERGY meda is used for ID Badges and access control cards, which are
  795. commonly used in 'hostile' environments (worn on uniform, used in stockrooms).
  796. Normal magnets will not affect these cards, and low-energy encoders cannot 
  797. write to them.
  798.  
  799.   
  800.                   ** Not All that Fluxes is Digital **
  801.    
  802.    Not all magstripe cards operate on a digital encoding method.  SOME cards
  803. encode AUDIO TONES, as opposed to digital data.  These cards are usually 
  804. used with old, outdated, industrial-strength equipment where security is not an
  805. issue and not a great deal of data need be encoded on the card.  Some subway
  806. passes are like this.  They require only expiration data on the magstripe, and
  807. a short series of varying frequencies and durations are enough.  Frequencies
  808. will vary with the speed of swiping, but RELATIVE frequencies will remain the
  809. same (for instance, tone 1 is twice the freq. of tone 2, and .5 the freq of
  810. tone 3, regardless of the original frequencies!).  Grab an oscilliscope to
  811. visualize the tones, and listen to them on your stereo.  I haven't experimented
  812. with these types of cards at all.
  813.  
  814.          
  815.                       ** Security and Smartcards **
  816.   
  817.   Many security systems utilize magstripe cards, in the form of passcards and
  818. ID cards.  It's interesting, but I found in a NUMBER of cases that there was
  819. a serious FLAW in the security of the system.  In these cases, there was a
  820. code number PRINTED on the card.  When scanned, I found this number encoded on 
  821. the magstripe.  Problem was, the CODE NUMBER was ALL I found on the magstripe!
  822. Meaning, by just looking at the face of the card, I immediately knew exactly 
  823. what was encoded on it.  Ooops!  Makes it pretty damn easy to just glance at
  824. Joe's card during lunch, then go home and pop out my OWN copy of Joe's access
  825. card!  Fortunately, I found this flaw only in 'smaller' companies (sometimes
  826. even universities).  Bigger companies seem to know better, and DON'T print 
  827. ALL of the magstripe data right on card in big, easily legible numbers.  At
  828. least the big companies *I* checked. ;)
  829.   Other security blunders include passcard magstripes encoded ONLY with the
  830. owner's social security number (yeah, real difficult to find out a person's
  831. SS#...GREAT idea), and having passcards with only 3 or 4 digit codes.  
  832.  
  833.   Smartcard technology involves the use of chips embedded in plastic cards, 
  834. with pinouts that temporarily contact the card reader equipment.  Obviously,
  835. a GREAT deal of data could be stored in this way, and unauthorized duplication
  836. would be very difficuly.  Interestingly enough, not much effort is being put
  837. into smartcards by the major credit card companies.  They feel that the tech
  838. is too expensive, and that still more data can be squeezed onto magstripe
  839. cards in the future (especially Track 1).  I find this somewhat analagous to
  840. the use of metallic oxide disk media.  Sure, it's not the greatest (compared
  841. to erasable-writable optical disks), but it's CHEAP..and we just keep improving
  842. it.  Magstripes will be around for a long time to come.  The media will be
  843. refined, and data density increased.  But for conventional applications, the
  844. vast storage capabilities of smartcards are just not needed.  
  845.  
  846.  
  847.                    ** Biometrics: Throw yer cards away! **
  848.   
  849.   I'd like to end with a mention of biometrics: the technology based on reading
  850. the physical attributes of an individual thru retina scanning, signature
  851. verification, voice verification, and other means.  This was once limited to
  852. government use and to supersensitive installations.  However, biometrics will
  853. soon acquire a larger market share in access control sales because much of its
  854. development stage has passed and costs will be within reach of more buyers.
  855. Eventually, we can expect biometrics to replace pretty much ALL cards..because
  856. all those plastic cards in your wallet are there JUST to help COMPANIES
  857. *identify* YOU.  And with biometrics, they'll know you without having to read
  858. cards.  I'm not paranoid, nor do I subscribe to any grand 'corporate 
  859. conspiracy', but I find it a bit unsettling that our physical attributes will
  860. most likely someday be sitting in the cool, vast electronic databases of
  861. the CORPORATE world.  Accessable by anyone willing to pay.  Imagine CBI and TRW
  862. databases with your retina image, fingerprint, and voice pattern online for
  863. instant, convenient retrieval.  Today, a person can CHOOSE NOT to own a credit
  864. card or a bank card...we can cut up our plastic ID cards!  Without a card, a
  865. card reader is useless and cannot identify you.  Paying in cash makes you
  866. invisible!  However, with biometrics, all a machine has to do is watch...
  867. .listen...and record.  With government/corporate America pushing all the
  868. buttons..  "Are you paying in cash?...thank you...please look into the camera.
  869. Oh, I see your name is Mr. Smith...uh, oh...my computer tells me you haven't
  870. paid your gas bill....afraid I'm going to have to keep this money and credit
  871. your gas account with it....do you have any more cash?...or would you rather
  872. I garnish your paycheck?"  heh heh
  873.  
  874.  
  875.              ** Closing Notes (FINALLY!!!!) **
  876.  
  877.   Whew...this was one MOTHER of a phile.  I hope it was interesting, and I hope
  878. you distribute it to all you friends.  This phile was a production of
  879. "Restricted Data Transmissions"...a group of techies based in the Boston area
  880. that feel that "Information is Power"...and we intend to release a number of
  881. highly technical yet entertaining philes in the coming year....LOOK FOR THEM!!
  882. Tomorrow I'm on my way to Xmascon '91.....we made some slick  buttons 
  883. commemorating the event...if you ever see one of them (green wreath..XMASCON
  884. 1991 printed on it)..hang on to it!...it's a collector's item.. (hahahah)
  885. Boy, I'm sleepy...
  886.  
  887. Remember....    "Truth is cheap, but information costs!"
  888.  
  889. But -=RDT is gonna change all that... ;)  set the info FREE!  
  890.  
  891. Peace.
  892.  
  893.                       ..oooOO Count Zero OOooo..
  894.   
  895. Usual greets to Magic Man, Brian Oblivion, Omega, White Knight, and anyone
  896. else I ever bummed a cigarette off.....
  897.  
  898. (1/18/92 addition: Greets to everyone I met at Xmascon..incuding but not
  899. excluding Crimson Death, Dispater, Sterling, Mackhammer, Erik Bloodaxe,
  900. Holistic Hacker, Pain Hertz, Swamp Ratte, G.A.Ellsworth, Phaedrus, Moebius,
  901. Lord MacDuff, Judge Dredd, and of course hats of to *Drunkfux* for organizing
  902. and taking responsibility for the whole damn thing.  Hope to see all of you
  903. at Summercon '92!  Look for Cyber-stripper GIFs at a BBS near you..heh heh) 
  904.  
  905. Comments, criticisms, and discussions about this phile are welcome.  I can be
  906. reached at
  907.                   count0@world.std.com
  908.                   count0@spica.bu.edu
  909.                   count0@atdt.org
  910.  
  911. Magic Man and I are the sysops of the BBS "ATDT"...located somewhere in
  912. Massachusetts.  Great message bases, technical discussions...data made
  913. flesh...electronic underground.....our own Internet address (atdt.org)...
  914. .field trips to the tunnels under MIT in Cambridge.....give it a call..
  915. ..mail me for more info.. ;)
  916.  
  917.                     ATDT------(???)YOU-WISH  
  918.    (You're not paranoid if they're REALLY out to get you... ;)
  919.  
  920.